package it.softphone.cmc.server.service;

import it.softphone.cmc.shared.entity.Asset;
import it.softphone.cmc.shared.entity.ScriptletAsset;
import it.softphone.commons.json.server.JSONException;

import javax.script.ScriptException;


/**
 * 
 * @author softphone
 *
 */
public interface ScriptletManagerService {

	/**
	 * 
	 * @param s
	 * @return
	 */
	ClassLoader getCL( ScriptletAsset s );
	
	/**
	 * 
	 * @return
	 */
	ScriptletAsset makeScriptlet();
	
	/**
	 * 
	 * @param object
	 * @return
	 * @throws JSONException
	 */
	ScriptletAsset makeScriptletFromJson( it.softphone.commons.json.server.JSONObject object ) throws JSONException;
	
	/**
	 * 
	 * @param s
	 */
	void saveScriptlet( ScriptletAsset s );
	
	/**
	 * 
	 * @param key
	 * @return
	 */
	ScriptletAsset findScriptletByKey( String key );

	/**
	 * 
	 * @param filter
	 * @return
	 */
	java.util.List<String> findScriptletKeys( Asset filter );
	
	
	Object execScriptlet( ScriptletAsset s, Object... args ) throws ScriptException, NoSuchMethodException ;
	
}
